@include ('user.header', ['title' => '编辑短网址'])
  
<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <div class="container">
      <ol class="breadcrumb mb-0">
          <li class="breadcrumb-item"><a href="/user">用户中心</a></li>
          <li class="breadcrumb-item"><a href="/user/dwz-list/{{$domain['id']}}">短网址列表【{{$domain['domain']}}】</a></li>
          <li class="breadcrumb-item active" aria-current="page">编辑短网址</li>
      </ol>
  </div>
</nav>
  <div class="container py-4">
    <div class="row">
      <div class="col-xs-12 col-sm-8">
        {{session('status')}}
        @if ( session('status') )
          @if (session('status') == '0')
          <div class="alert alert-warning">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            {{ session('msg') }}
          </div>
          @elseif (session('status') == '2')
          <div class="alert alert-warning">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            {{ session('msg') }}
          </div>
          @else
          <div class="alert alert-success">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            {{ session('msg') }}
          </div>
          @endif
        @endif
        @if (isset($dwzurl))
        <div class="card shadow-sm mb-3">
          <div class="card-body p-3">
            <form action="/api/dwz/edit/{{$dwzurl['id']}}" method="post" class="needs-validation" novalidate id="editForm">
              @csrf
              <input type="hidden" name="api_token" value="{{session('user')->api_token}}">
              
              <div class="mb-3">
                <label for="domain" class="form-label">域名前缀</label>
                <input type="text" name="domain" id="domain" value="{{$domain['domain']}}" class="form-control" disabled required>
              </div>
              
              <div class="mb-3">
                <label for="url" class="form-label">跳转地址</label>
                <input type="url" name="url" id="url" value="{{$dwzurl['url']}}" class="form-control" placeholder="如：wwww.mengyunblog.com" required>
              </div>
              
              <div class="mb-3">
                <label for="code" class="form-label">域名后缀</label>
                <input type="text" name="code" id="code" value="{{$dwzurl['code']}}" class="form-control" placeholder="自定义长度，不填则随机生成" @if($domain['uid']!=$dwzurl['uid']) disabled @endif>
              </div>
              
              <div class="d-grid gap-2 mt-4">
                <input type="submit" class="btn btn-primary btn-sm rounded-pill py-2 fs-6 shadow-sm" value="更改">
              </div>
            </form>
          </div>
        </div>
        @endif
      </div>
      <div class="col-xs-12 col-sm-4">
        <b>跳转地址</b><br/>
        跳转地址要带上http://或者https://的玩着域名<hr/>
        <b>自定义后缀</b><br/>
        填写xxx则短连接是{{ $domain['domain'] }}/xxx，不填则随机生成
      </div>
    </div>
  </div>
@include('user.footer')